﻿
namespace Lib.Configuration.Entitys;
/// <summary>
/// 网站参数配置类
/// </summary>
[Serializable]
public partial class Option {
    /// <summary>
    /// 构造函数
    /// </summary>
    public Option() { }
    /// <summary>
    /// 初始化默认值
    /// </summary>
    public void Initialize() {

        if(string.IsNullOrEmpty(LangueCulture)) {
            LangueCulture = "zh-CN";
        }
        if (string.IsNullOrEmpty(Token)) {
            Token = "AccessToken";
        }
        if (string.IsNullOrEmpty(AuthCode)) {
            AuthCode = "Code";
        }
        if (string.IsNullOrEmpty(SessionName)) {
            SessionName = "UseKey";
        }
        if (!Status.HasValue) {
            Status = true;
        }
        if (!Minute.HasValue) {
            Minute = 30;
        }
        if (!Timeout.HasValue) {
            Timeout = 30;
        }
        if (!CookieTimeout.HasValue) {
            CookieTimeout = 30;
        }
        if (!AccessLog.HasValue) {
            AccessLog = true;
        }
        if (!CommandLog.HasValue) {
            CommandLog = true;
        }
        if (!EnablePoint.HasValue) {
            EnablePoint = true;
        }
        if (!EnableExp.HasValue) {
            EnableExp = true;
        }
    }
    /// <summary>
    /// 网站根域名
    /// </summary>
    public string Domain { get; set; }
    /// <summary>
    /// 网站维护描述
    /// </summary>
    public string Description { get; set; }
    /// <summary>
    /// 网站默认语言
    /// </summary>
    public string LangueCulture { get; set; }
    /// <summary>
    /// 网站当前状态(维护期间可设置关闭状态) True - 打开, False - 关闭
    /// </summary>
    public bool? Status { get; set; }




    /// <summary>
    /// 授权码名称（授权许可模式）, 授权许可模式访问资源, 登录前先获取“授权码”, 再通过“授权码、账号、密码”登录后获取“授权凭证.AccessToken”
    /// </summary>
    public string AuthCode { get; set; }
    /// <summary>
    /// 授权凭证名称[令牌]（授权许可模式）
    /// </summary>
    public string Token { get; set; }
    /// <summary>
    /// 加密与解密默认密钥
    /// </summary>
    public string SecretKey { get; set; }
    /// <summary>
    /// 在线超时时间(分钟数)
    /// </summary>
    public int? Minute { get; set; }



    /// <summary>
    /// 会话(Session)名称 
    /// </summary>
    public string SessionName { get; set; }
    /// <summary>
    /// 会话(Session) 有效期(分钟)
    /// </summary>
    public int? Timeout { get; set; }



    /// <summary>
    /// Cookies 主名称
    /// </summary>
    public string CookieName { get; set; }
    /// <summary>
    /// Cookies 有效期(分钟)
    /// </summary>
    public double? CookieTimeout { get; set; }



    /// <summary>
    /// 是否启用访问日志
    /// </summary>
    public bool? AccessLog { get; set; }
    /// <summary>
    /// 是否启用命令日记
    /// </summary>
    public bool? CommandLog { get; set; }


    /// <summary>
    /// 启用点券系统
    /// </summary>
    public bool? EnablePoint { get; set; }
    /// <summary>
    /// 启用积分系统
    /// </summary>
    public bool? EnableExp { get; set; }


}

